package oop.java0321;

/**
 * 4:计算器用颜色，品牌，价格等属性，有计算加减乘除以及算一个数立方的方法，用oo的思想模拟。
 */
public class Calc {
    String color;
    String brand;
    float price;

    public int add(int a, int b) {
        return a + b;
    }

    public double add(double a, double b) {
        return a + b;
    }

    //减sub
    public int sub(int a, int b) {
        return b - a;
    }

    public double sub(double a, double b) {
        return b - a;
    }

    //乘mul
    public int mul(int a, int b) {
        return a * b;
    }

    public double mul(double a, double b) {
        return a * b;
    }

    //除div
    public int div(int a, int b) {
        return b / a;
    }

    public double div(double a, double b) {
        return b / a;
    }

    //立方cube
    public int cube(int a) {
        return a * a * a;
    }

    public double cube(double a) {
        return a * a * a;
    }

    //展示计算器信息
    public void showInfo() {
        System.out.println("品牌：" + brand);
        System.out.println("颜色：" + color);
        System.out.println("价格：" + price + "元");
    }
}
